package ioc06;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Calendar;
import java.util.Date;

/**
 * Author:shixiaojun@itany.com
 * Date:2022/5/16 14:56
 * Version:1.0-SNAPSHOT
 * Description:
 */
public class Test {

    public static void main(String[] args) {
//        ObjectFactory factory = new ObjectFactory();
//        SomeService someService = (SomeService) factory.getObject();

        ApplicationContext ac = new ClassPathXmlApplicationContext("ioc06/spring.xml");
        SomeService someService = (SomeService) ac.getBean("someService");
        someService.doSome();
        someService.doOther();

        // 练习
        // 由Spring管理date
//        Calendar calendar = Calendar.getInstance();
//        Date date = calendar.getTime();
        Date date = (Date) ac.getBean("date");
        System.out.println(date);

    }

}
